﻿using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace shenghua.Migrations
{
    public partial class addentity3 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Areas");

            migrationBuilder.DropTable(
                name: "CommodityClasses");

            migrationBuilder.DropTable(
                name: "FriendlyLinks");

            migrationBuilder.DropTable(
                name: "Guarantees");

            migrationBuilder.DropTable(
                name: "MemberFormItems");

            migrationBuilder.DropTable(
                name: "MemberGroups");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MemberLevels",
                table: "MemberLevels");

            migrationBuilder.DropColumn(
                name: "Price",
                table: "Commodities");

            migrationBuilder.RenameTable(
                name: "MemberLevels",
                newName: "WordNodes");

            migrationBuilder.RenameColumn(
                name: "CommodityCount",
                table: "ShoppingCartCommodities",
                newName: "Count");

            migrationBuilder.RenameColumn(
                name: "MemberId",
                table: "Orders",
                newName: "MemberInfo_Id");

            migrationBuilder.RenameColumn(
                name: "CommodityId",
                table: "Orders",
                newName: "Info_BounsXPValue");

            migrationBuilder.RenameColumn(
                name: "Level",
                table: "AbpUsers",
                newName: "LevelIDName");

            migrationBuilder.AddColumn<string>(
                name: "Info_Description",
                table: "Orders",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Info_OrderNumber",
                table: "Orders",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "Info_Status",
                table: "Orders",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "Info_Subject",
                table: "Orders",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "EvaluateInfo_Description",
                table: "Orders",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "EvaluateInfo_EvaluateStatus",
                table: "Orders",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<double>(
                name: "EvaluateInfo_RateValue",
                table: "Orders",
                nullable: false,
                defaultValue: 0.0);

            migrationBuilder.AddColumn<string>(
                name: "MemberInfo_UserName",
                table: "Orders",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "PaymentInfo_PaymentMethod",
                table: "Orders",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "PaymentInfo_PaymentStatus",
                table: "Orders",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "PaymentInfo_TradeNumber",
                table: "Orders",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "ShipInfo_Address",
                table: "Orders",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "ShipInfo_ShipStatus",
                table: "Orders",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "Info_CouponAmount_MoneyType",
                table: "Orders",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<double>(
                name: "Info_CouponAmount_Value",
                table: "Orders",
                nullable: false,
                defaultValue: 0.0);

            migrationBuilder.AddColumn<int>(
                name: "Info_DiscountAmount_MoneyType",
                table: "Orders",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<double>(
                name: "Info_DiscountAmount_Value",
                table: "Orders",
                nullable: false,
                defaultValue: 0.0);

            migrationBuilder.AddColumn<int>(
                name: "Info_FreightAmount_MoneyType",
                table: "Orders",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<double>(
                name: "Info_FreightAmount_Value",
                table: "Orders",
                nullable: false,
                defaultValue: 0.0);

            migrationBuilder.AddColumn<int>(
                name: "Info_TotalAmount_MoneyType",
                table: "Orders",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<double>(
                name: "Info_TotalAmount_Value",
                table: "Orders",
                nullable: false,
                defaultValue: 0.0);

            migrationBuilder.AddColumn<int>(
                name: "Info_XPAmount_MoneyType",
                table: "Orders",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<double>(
                name: "Info_XPAmount_Value",
                table: "Orders",
                nullable: false,
                defaultValue: 0.0);

            migrationBuilder.AddColumn<int>(
                name: "XPValue",
                table: "Commodities",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "Price_MoneyType",
                table: "Commodities",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<double>(
                name: "Price_Value",
                table: "Commodities",
                nullable: false,
                defaultValue: 0.0);

            migrationBuilder.AddColumn<double>(
                name: "Discount",
                table: "WordNodes",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "NeededXP",
                table: "WordNodes",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Discriminator",
                table: "WordNodes",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<string>(
                name: "DisplayName",
                table: "WordNodes",
                nullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_WordNodes",
                table: "WordNodes",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "FileItems",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    UserId = table.Column<long>(nullable: false),
                    Name = table.Column<string>(nullable: true),
                    Labels_StringValue = table.Column<string>(nullable: true),
                    Size = table.Column<long>(nullable: false),
                    Path = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FileItems", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "OrderDetails",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    OrderId = table.Column<int>(nullable: false),
                    CommodityId = table.Column<int>(nullable: false),
                    CommodityName = table.Column<string>(nullable: true),
                    Count = table.Column<int>(nullable: false),
                    Price_MoneyType = table.Column<int>(nullable: false),
                    Price_Value = table.Column<double>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrderDetails", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "PaymentLogs",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PaymentLogs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Refunds",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    OrderId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Refunds", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "FileItems");

            migrationBuilder.DropTable(
                name: "OrderDetails");

            migrationBuilder.DropTable(
                name: "PaymentLogs");

            migrationBuilder.DropTable(
                name: "Refunds");

            migrationBuilder.DropPrimaryKey(
                name: "PK_WordNodes",
                table: "WordNodes");

            migrationBuilder.DropColumn(
                name: "Info_Description",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_OrderNumber",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_Status",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_Subject",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "EvaluateInfo_Description",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "EvaluateInfo_EvaluateStatus",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "EvaluateInfo_RateValue",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "MemberInfo_UserName",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "PaymentInfo_PaymentMethod",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "PaymentInfo_PaymentStatus",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "PaymentInfo_TradeNumber",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "ShipInfo_Address",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "ShipInfo_ShipStatus",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_CouponAmount_MoneyType",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_CouponAmount_Value",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_DiscountAmount_MoneyType",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_DiscountAmount_Value",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_FreightAmount_MoneyType",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_FreightAmount_Value",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_TotalAmount_MoneyType",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_TotalAmount_Value",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_XPAmount_MoneyType",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "Info_XPAmount_Value",
                table: "Orders");

            migrationBuilder.DropColumn(
                name: "XPValue",
                table: "Commodities");

            migrationBuilder.DropColumn(
                name: "Price_MoneyType",
                table: "Commodities");

            migrationBuilder.DropColumn(
                name: "Price_Value",
                table: "Commodities");

            migrationBuilder.DropColumn(
                name: "Discount",
                table: "WordNodes");

            migrationBuilder.DropColumn(
                name: "NeededXP",
                table: "WordNodes");

            migrationBuilder.DropColumn(
                name: "Discriminator",
                table: "WordNodes");

            migrationBuilder.DropColumn(
                name: "DisplayName",
                table: "WordNodes");

            migrationBuilder.RenameTable(
                name: "WordNodes",
                newName: "MemberLevels");

            migrationBuilder.RenameColumn(
                name: "Count",
                table: "ShoppingCartCommodities",
                newName: "CommodityCount");

            migrationBuilder.RenameColumn(
                name: "MemberInfo_Id",
                table: "Orders",
                newName: "MemberId");

            migrationBuilder.RenameColumn(
                name: "Info_BounsXPValue",
                table: "Orders",
                newName: "CommodityId");

            migrationBuilder.RenameColumn(
                name: "LevelIDName",
                table: "AbpUsers",
                newName: "Level");

            migrationBuilder.AddColumn<float>(
                name: "Price",
                table: "Commodities",
                nullable: false,
                defaultValue: 0f);

            migrationBuilder.AddPrimaryKey(
                name: "PK_MemberLevels",
                table: "MemberLevels",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "Areas",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    Icon = table.Column<string>(nullable: true),
                    IsDefault = table.Column<bool>(nullable: false),
                    LinkAddress = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    OnlyMemberVisible = table.Column<bool>(nullable: false),
                    ParentId = table.Column<int>(nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    Tag = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Areas", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CommodityClasses",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    Icon = table.Column<string>(nullable: true),
                    IsDefault = table.Column<bool>(nullable: false),
                    LinkAddress = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    OnlyMemberVisible = table.Column<bool>(nullable: false),
                    ParentId = table.Column<int>(nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    Tag = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CommodityClasses", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "FriendlyLinks",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    Icon = table.Column<string>(nullable: true),
                    IsDefault = table.Column<bool>(nullable: false),
                    LinkAddress = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    OnlyMemberVisible = table.Column<bool>(nullable: false),
                    ParentId = table.Column<int>(nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    Tag = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FriendlyLinks", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Guarantees",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    Icon = table.Column<string>(nullable: true),
                    IsDefault = table.Column<bool>(nullable: false),
                    LinkAddress = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    OnlyMemberVisible = table.Column<bool>(nullable: false),
                    ParentId = table.Column<int>(nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    Tag = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Guarantees", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MemberFormItems",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    Icon = table.Column<string>(nullable: true),
                    IsDefault = table.Column<bool>(nullable: false),
                    LinkAddress = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    OnlyMemberVisible = table.Column<bool>(nullable: false),
                    ParentId = table.Column<int>(nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    Tag = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberFormItems", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MemberGroups",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    Icon = table.Column<string>(nullable: true),
                    IsDefault = table.Column<bool>(nullable: false),
                    LinkAddress = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    OnlyMemberVisible = table.Column<bool>(nullable: false),
                    ParentId = table.Column<int>(nullable: true),
                    Sort = table.Column<int>(nullable: false),
                    Tag = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberGroups", x => x.Id);
                });
        }
    }
}
